package com;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ling
 * Date: 2023-11-03
 * Time: 9:39
 */
@Controller
public class Student2 implements Human{
    Integer number;
    String name;

    private Teacher teacher;

    @Autowired
    public Student2(@Qualifier("teacherBean")Teacher teacher,String name) {
        this.teacher = teacher;
        this.name = name;
    }
    @Override
    public void study() {
        System.out.println(teacher.name + "老师和" + this.name + "正在学习");
    }

    @Override
    public String toString() {
        return "Student2{" +
                "number=" + number +
                ", name='" + name + '\'' +
                ", teacher=" + teacher +
                '}';
    }
}
